#! usr/bin/python
#coding=utf-8
import pyrequest
import requests
import unittest
class GetEventListTest(unittest.TestCase):
    '''查询发布会接口'''
    def setUp(self):
        self.url = 'http://127.0.0.1:8000/api/get_event_list/'

    def test_guest_event_null(self):
        '''发布会id为空'''
        r = requests.get(self.url, params={'eid':''})
        result = r.json()
        self.assertEqual(result['status'], 10021)
        self.assertEqual(result['message'], 'parameter error')

    def test_get_event_success(self):
        r = requests.get(self.url, params={'eid':'1'})
        result = r.json()
        print(result)
        self.assertEqual(result["status"], 200)
        self.assertEqual(result['message'],'success')
        # self.assertEqual(result['name'],u"红米发布会")
        # self.assertEqual(result['address'],'水立方发布中心')
        # self.assertEqual(result['start_time','2017-04-07T14:27:01Z'])
if __name__ == '__main__':
    unittest.main()